from brian import *
from brian.library.random_processes import *
from brian.library.synapses import  *
import mydata as mydat
import NeuronFactory_MN as NeuronFactory



#defaultclock.dt = 0.0025*ms

md2=mydat.globVars()
md2.DUR=16000

myfac = NeuronFactory.NeuronFactory() 
 

#P=myfac.generateIN(1)
#P=myfac.generate(1, -66)
P=myfac.generate(1,-71.33,-74.42)

trace=StateMonitor(P,'vm',record=[0])
traceD=StateMonitor(P,'vmd',record=[0])
traceCA=StateMonitor(P,'ca',record=[0])
net = Network(P,trace,traceD,traceCA)

net.run(md2.DUR*msecond)
figure(1)
subplot(211)
plot(trace.times/ms,trace[0]/mV)
#subplot(212)
plot(traceD.times/ms,traceD[0]/mV)
subplot(212)
plot(traceCA.times/ms,traceCA[0]/(10**-6*mole*dmetre**-3))

show()

